home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume4 / quickplot / part1 next >
Encoding:
Internet Message Format  |  1986-11-30  |  16.1 KB

  1. Subject: lplot and quickplot (Part 1 of 2)
  2. From: Duane Hesser <talcott!seismo!hplsla!tikal!sysad>
  3. Newsgroups: mod.sources
  4. Approved: jpn@panda.UUCP
  5.  
  6. Mod.sources:  Volume 4, Issue 93
  7. Submitted by: Duane Hesser <seismo!hplsla!tikal!sysad>
  8.  
  9. This source distribution contains source for "lplot" and "quickplot";
  10. filters for P300 and ascii terminals primarily for BSD sites.  The
  11. latter makes a printable ascii approximation of a standard Unix plot
  12. stream on any ascii device.  "Lplot" makes an output stream which will
  13. use the plot mode of a Printronix P300 or equivalent printer.
  14.  
  15. The README describes the programs in more detail, along with a few
  16. portability issues.  Also included are some simple "C" programs to
  17. generate arcs, lines, etc.; useful for testing lplot and quickplot.
  18. -----cut here-----------cut here-----------cut here-------
  19. #! /bin/sh
  20. # This is a shell archive, meaning:
  21. # 1. Remove everything above the #! /bin/sh line.
  22. # 2. Save the resulting text in a file.
  23. # 3. Execute the file with /bin/sh (not csh) to create the files:
  24. #    README
  25. #    lplot.p
  26. #    quickplot.p
  27. # This archive created: Fri May  2 18:20:50 1986
  28. export PATH; PATH=/bin:$PATH
  29. echo shar: extracting "'README'" '(6240 characters)'
  30. if test -f 'README'
  31. then
  32.     echo shar: will not over-write existing file "'README'"
  33. else
  34. cat << \SHAR_EOF > 'README'
  35. /*
  36.  * It is the intent of the author that this software may  be
  37.  * distributed and used freely, without restriction.  If you
  38.  * make improvements or enhancements,  I would appreciate  a
  39.  * copy.
  40.  
  41.  * The author makes no warranty,  express or implied, as  to
  42.  * the functioning or  suitability of the  software for  any
  43.  * purpose, and  the fact  of distribution  implies no  such
  44.  * warranty.   The  author  assumes  no  responsibility  for
  45.  * himself or others in connection with this software of any
  46.  * use of it (i.e., you may  use it freely, but don't  blame
  47.  * me if something goes wrong).
  48.  
  49.  * Duane H. Hesser, Teltone Corporation
  50.  * ....uw-beaver!tikal!sysad
  51.  * ....uw-beaver!tikal!dhh
  52.  */
  53.  
  54. "lplot"  is  a  plot(3)  filter  for  Printronix  P300   (or
  55. equivalent) printers.  "quickplot"  is a plot(3) filter  for
  56. any ascii  terminal.   "Quickplot" can  be used  to  display
  57. simple low-resolution plots, but is probably more useful for
  58. previewing plot streams before plotting on a real  plottting
  59. device.
  60.  
  61. "lplot" accepts  the  arguments  which  the  4.2BSD  printer
  62. spooler sends  to plot  filters (hostname,  user, and  pixel
  63. sizes), and  thus may  be used  in /etc/printcap  on  4.2BSD
  64. systems as the "g" filter  for a printer.  (These  arguments
  65. are optional.)  Please see  the  supplied manual  pages  for
  66. further information about behavior and available options.
  67.  
  68. These programs have been compiled sucessfully under BSD  4.2
  69. on a  Pyramid, and  BSD 4.2  and 4.1  on Vax  750's.   There
  70. should be little  to prevent their  compilation on any  Unix
  71. system which has the plot(3) library. (ummm... you will also
  72. need some form of bzero() and bcopy()).
  73.  
  74. CAVEATS: "quickplot" needs the termcap library; it would not
  75. be difficult  to  do without  it.   "lplot"  requires  about
  76. 104kbytes for the output array (no raster file is used),  so
  77. machines with limited data space  will need to restrict  the
  78. plotting area  (cut  down the  array  size), or  modify  the
  79. point() and output()  routines to use  some sort of  virtual
  80. array with disk buffering.  BEWARE your line printer driver.
  81. Some drivers like to do a bit of processing on the data sent
  82. to them,  assuming that  you  want backspaces  and  carriage
  83. returns handled  specially, for  example.   The driver  must
  84. pass lplot  output  untainted by  its  own  pre-conceptions.
  85.  
  86. "lplot" assumes that the paper in the printer is  positioned
  87. at line 1,  rather than at  the fold, so  that printing  (or
  88. plotting) begins at the first line on the page.  This  means
  89. that it assumes 780  dots vertically, rather  than 792.   If
  90. this doesn't suit your  situation (and you find  top-of-form
  91. creeping), change YDOTS in "defs.h".  Horizontal dot density
  92. is 60 dots  per inch, vertical  dot density is  72 dots  per
  93. inch, and array space  is provided to  permit plotting on  a
  94. full page of 132 column by 11 inch printer paper.   Although
  95. the space()  routine  maps  its arguments  into  an  8  inch
  96. plotting area in the lower left corner of the page, plotting
  97. is  permitted  outside  that  range.    (Note:   "quickplot"
  98. truncates data outside the mapped area, which is taken to be
  99. the full terminal screen.)
  100.  
  101. MAKEFILES:
  102. There are 3 makefiles: one  for "lplot" one for  "quickplot"
  103. and one to control the other two.  The latter is "Makefile".
  104. If you type "make" by itself, the following list of  targets
  105. will be printed:
  106.  
  107.         Use:
  108.         make all             to update lplot and quickplot
  109.         make new             to make both from scratch
  110.         make clean           to remove .o files
  111.         make bclean          to remove binaries and .o files
  112.         make lplot           to make only lplot
  113.         make quickplot       to make only quickplot
  114.         make install         to update and install both
  115.         make install_l       to update and install lplot
  116.         make install_q       to update and install quickplot
  117.  
  118. You should edit "Makefile" to  set BIN (the directory  where
  119. the binaries are to be installed), and MAN (where the manual
  120. pages are to be copied).  As delivered, BIN=/usr/public/bin,
  121. MAN=/usr/man/manp.
  122.  
  123. You should also check the DEFINES.  Then type "make new"  to
  124. make both binaries (or "make install" if your want to do the
  125. whole thing  in one  swell  foop).   The DEFINES  should  be
  126. changed  in   Makefile.lplot   and   Makefile.quickplot   as
  127. appropriate.  "make install" will install the binaries,  and
  128. make a link to "lplot" called "rlplot".  "rlplot"  activates
  129. the 'rotate' option, which causes the plot to be rotated  90
  130. degress ccw.  We  use this in /etc/printcap  for one of  our
  131. printers in which we use 8 1/2 x 11 paper, with  appropriate
  132. pixel sizes, to  cause the  long dimension of  the paper  to
  133. appear "horizontal" to the plot.  If you don't have the  4.2
  134. spooler, don't use  narrow paper, or  just plain don't  need
  135. rotated  plots,  you  may  wish  to  delete  this  from  the
  136. makefile.
  137.  
  138. Note: the rather strange makefile setup is intended to  keep
  139. track of which  binary is  being created.   Loading  "lplot"
  140. with  object  files  created   with  QUICKPLOT  defined   is
  141. ineffective.  Use separate directories if you prefer.
  142.  
  143. DEFINES:
  144. define BIGENDIAN if  you are  compiling for  a machine  with
  145. mad-hatter byte-order (3,2,1,0,7,6,5,4...) like Pyramids and
  146. 68000's.  Leave it out for Vaxes.
  147.  
  148. define DEBUG to compile in some debugging code.  This is set
  149. in the  delivered makefiles,  and compiles  in a  '-d'  flag
  150. which permits 3  levels of debugging  output (controlled  by
  151. the 1,2,4  bits in  the single-  digit following  argument).
  152. '-d 1' outputs the decoded and scaled plot stream  commands,
  153. and can be useful for debugging plot streams; the  remaining
  154. bits are useful only for program debug.
  155.  
  156. define QUICKPLOT  to compile  "quickplot"; leave  it out  to
  157. compile  "lplot".    These  are   set  up  already  in   the
  158. appropriate makefiles.
  159.  
  160. All other defines are in "defs.h", and should not need to be
  161. changed unless you have a printer with different dot density
  162. or perhaps a different graphics code, etc.
  163.  
  164. ONE LAST THING
  165. The sources in  this distribution are  created with 4  space
  166. tabstops.  They contain comment-commands for later  versions
  167. of "vi" to set tabstops appropriately; if this doesn't  work
  168. for you, set tabstops manually to 4, use "expand -4", or run
  169. them thru a sed script or "indent".
  170. SHAR_EOF
  171. if test 6240 -ne "`wc -c < 'README'`"
  172. then
  173.     echo shar: error transmitting "'README'" '(should have been 6240 characters)'
  174. fi
  175. fi
  176. echo shar: extracting "'lplot.p'" '(4313 characters)'
  177. if test -f 'lplot.p'
  178. then
  179.     echo shar: will not over-write existing file "'lplot.p'"
  180. else
  181. cat << \SHAR_EOF > 'lplot.p'
  182. .TH LPLOT PUBLIC 
  183. .UC 4
  184. .SH NAME
  185. lplot \- plot filter for Printronix P300 style line printers
  186. .SH SYNOPSIS
  187. .B lplot
  188. [ option ] ...
  189. [ file ]
  190. [ option ] ...
  191. [ file ]  ...
  192. .SH DESCRIPTION
  193. .I Lplot
  194. accepts a plot stream as produced by the plot(3) functions and
  195. generates on the standard output a byte stream which will produce
  196. the plot on a Printronix P300 style line printer using the printer's
  197. "graphics" mode.
  198. No raster file is generated; plot data is sent directly to standard output.
  199. .PP
  200. By default, plots are scaled to an 8 inch square plotting area,
  201. to be consistent in scale with other plot filters.
  202. Arguments are provided to change scaling in one or both directions,
  203. change the area into which the space() (see plot(3)) call maps
  204. user data, change the position of the plot on the page, or rotate
  205. the plot 90 degrees counter clockwise (useful primarily for printers
  206. loaded with 8 1/2 x 11 inch paper).
  207. .PP
  208. .I Lplot
  209. will accept the arguments passed by the Berkeley 4.2BSD printer
  210. spooler for accounting; thus it may be used in /etc/printcap as
  211. the "g" filter on such systems.  No accounting is performed, of
  212. course, if these arguments are not given  Arguments for pixel width and
  213. height are also recognized and used (within compiled-in limits).
  214. .PP
  215. If called as
  216. .I rlplot,
  217. the plot will be rotated 90 degrees counter-clockwise (-r flag) and the
  218. origin will be located at the lower right of the page.
  219. .PP
  220. If no file arguments are given,
  221. .I lplot
  222. reads from the standard input.
  223. If file arguments are given, an argument consisting of the single
  224. character '-' will be replaced by the standard input.
  225. .PP
  226. The P300 printer has a resolution of 60 dots per inch horizontally,
  227. 72 dots per inch vertically.
  228. The default 8 inch plot area is thus 480 dots x 576 dots.
  229. The maximum plot area is 780 dots x 792 dots (12 dots are unavailable
  230. when the print head is positioned at the first printable line).
  231. .SH OPTIONS
  232. .IP "-H \fIx\fP" 15n
  233. limit the plot to \fIx\fP dots horizontally (maximum 792).
  234. .IP "-W \fIy\fP" 15n
  235. limit the plot to \fIy\fP dots vertically (maximum 780).
  236. .IP "-s[xy] \fIfactor\fP" 15n
  237. set an overall scale factor.  The plot is magnified by the scale factor
  238. (but may be truncated if the resulting plot area is larger than the
  239. page).  If \fIx\fP or
  240. \fIy\fP is given, the scale factor will be applied in the indicated
  241. direction only.
  242. .IP "-X \fInum\fP" 15n
  243. move the plot right \fInum\fP inches (negative \fInum\fP moves left).
  244. .IP "-Y \fInum\fP" 15n
  245. move the plot up \fInum\fP inches (negative \fInum\fP moves down).
  246. \fIchar\fP
  247. .IP "-e" 15n
  248. force an erase command between plot files
  249. .IP "-N" 15n
  250. suppress erase commands
  251. .IP "-r" 15n
  252. rotate the plot 90 degrees counter-clockwise
  253. .IP "-d num" 15n
  254. set debugging level to
  255. .I num
  256. (debugging is conditionally compiled; this may have no effect).
  257. The most useful setting is '1', which causes
  258. .I quickplot
  259. to print the plot(3) commands as it interprets them, with
  260. arguments scaled to final values.
  261. The plot is still generated.
  262. .IP "-x\fInum\fP" 15n
  263. limit the plot to \fInum\fP dots horizontally (maximum 792).
  264. Included for compatibility with the 4.2BSD line printer spooler.
  265. .IP "-y\fInum\fP" 15n
  266. limit the plot to \fInum\fP dots vertically (maximum 780).
  267. Included for compatibility with the 4.2BSD line printer spooler.
  268. .SH NOTE BENE
  269. .PP
  270. It is permissible to plot outside the 8 inch square, but
  271. data outside the page will be truncated (plotted at the maximum
  272. plot point).
  273. .SH DIAGNOSTICS
  274. \'Bad input data: cmd %o' if an unrecognized plot command is received.
  275. May happen if labels contain newlines, or plot stream files
  276. are corrupted.    Scanning will continue.
  277. Premature EOF while reading data for a command will generate an
  278. appropriate error and the program will quit.
  279. .SH "SEE ALSO"
  280. quickplot(1)
  281. .SH AUTHOR
  282. Duane Hesser (sysad@teltone)
  283. .SH BUGS
  284. Labels are plotted by internal table on an 8 dot wide x 9 dot
  285. high grid (including 2 descenders).  The resulting labels will
  286. generally scale somewhat larger than labels generated by other
  287. plot filters.
  288. Fonts are not available.
  289. .PP
  290. Resolution is poor.
  291. .PP
  292. .I Lplot
  293. attempts to send minimum data to the printer,
  294. by sending bytes only up to the last byte in each row containing
  295. data;  this accomplishes little, however, if the plot is boxed.
  296. (Plotting is slow.)
  297. .PP
  298. There is no way to rotate characters for vertical labeling.
  299. SHAR_EOF
  300. if test 4313 -ne "`wc -c < 'lplot.p'`"
  301. then
  302.     echo shar: error transmitting "'lplot.p'" '(should have been 4313 characters)'
  303. fi
  304. fi
  305. echo shar: extracting "'quickplot.p'" '(3842 characters)'
  306. if test -f 'quickplot.p'
  307. then
  308.     echo shar: will not over-write existing file "'quickplot.p'"
  309. else
  310. cat << \SHAR_EOF > 'quickplot.p'
  311. .TH QUICKPLOT PUBLIC 
  312. .UC 4
  313. .SH NAME
  314. quickplot \- make a printable ascii approximation of a plot stream
  315. .SH SYNOPSIS
  316. .B quickplot
  317. [ option ] ...
  318. [ file ]
  319. [ option ] ...
  320. [ file ]  ...
  321. .SH DESCRIPTION
  322. .I Quickplot
  323. accepts a plot stream as produced by the plot(3) functions and
  324. generates on the standard output a byte stream which is a printable
  325. ascii approximation of the plot, suitable for viewing on an ascii
  326. terminal or printing device.  Quickplot is useful for previewing
  327. plots on your terminal before sending to a plotting device.
  328. .PP
  329. .I Quickplot
  330. consults the termcap database for your terminal type (as given by
  331. the TERM environment variable) and attempts to size the plot to
  332. fill your screen.  The terminal type may be overridden by specifying
  333. a terminal type on the command line or by specifying the rows and
  334. columns desired (see OPTIONS below).
  335. .PP
  336. If no file arguments are given,
  337. .I quickplot
  338. reads from the standard input.
  339. If file arguments are given, an argument consisting of the single
  340. character '-' will be replaced by the standard input.
  341.  
  342. .SH OPTIONS
  343. .IP "-T \fIterm\fP" 15n
  344. make a plot suitable for terminal given by \fIterm\fP.
  345. .IP "-H \fIrows\fP" 15n
  346. map the plot into \fIrows\fP rows, instead of the rows given by termcap.
  347. .IP "-W \fIcols\fP" 15n
  348. map the plot into \fIcols\fP cols, instead of the cols given by termcap.
  349. .IP "-s[xy] \fIfactor\fP" 15n
  350. set an overall scale factor.  The plot is magnified by the scale factor
  351. (but may be truncated if the screen is too small).  If \fIx\fP or
  352. \fIy\fP is given, the scale factor will be applied in the indicated
  353. direction only.
  354. .IP "-X \fIcols\fP" 15n
  355. move the plot right \fIcols\fP cols (negative \fIcols\fP moves left).
  356. .IP "-Y \fIrows\fP" 15n
  357. move the plot up \fIrows\fP  rows (negative \fIrows\fP moves down).
  358. .IP "-c \fIchar\fP" 15n
  359. The plotting character (default upper case 'X') will be replaced by
  360. \fIchar\fP
  361. .IP "-e" 15n
  362. force an erase command between plot files
  363. .IP "-N" 15n
  364. suppress erase commands
  365. .IP "-r" 15n
  366. rotate the plot 90 degrees counter-clockwise
  367. .IP "-d num" 15n
  368. set debugging level to
  369. .I num
  370. (debugging is conditionally compiled; this may have no effect).
  371. The most useful setting is '1', which causes
  372. .I quickplot
  373. to print the plot(3) commands as it interprets them, with
  374. arguments scaled to final values.
  375. The plot is still generated.
  376. .SH NOTE BENE
  377. .I Quickplot
  378. is unlike most plot filters in that it does not map your
  379. plot space specifically into a square plotting area; instead, it
  380. attempts to obtain maximum resolution by mapping the plot into the
  381. full screen.
  382. Since most terminals have many more columns than rows, most plots
  383. will be "distorted" (a square box will plot as a rectangle).
  384. .PP
  385. Data outside the plot area will be truncated (plotted at the maximum
  386. plot point) and the normal plot character will be replaced by the
  387. character '@' (which does not change if you select '@' as the plot
  388. character).
  389. .PP
  390. IF MORE THAN ONE PLOT FILE IS GIVEN AS ARGUMENT,
  391. .I quickplot
  392. will pause
  393. .B SILENTLY
  394. between plots (unless standard output and standard error have been
  395. re-directed) and wait for a single carriage return before proceeding
  396. to the next plot.
  397. .SH DIAGNOSTICS
  398. \'Bad input data: cmd %o' if an unrecognized plot command is received.
  399. May happen if labels contain newlines, or plot stream files
  400. are corrupted.    Scanning will continue.
  401. Premature EOF while reading data for a command will generate an
  402. appropriate error and the program will quit.
  403. .SH "SEE ALSO"
  404. lplot(1)
  405. .SH AUTHOR
  406. Duane Hesser (sysad@teltone)
  407. .SH BUGS
  408. Resolution is understandably poor.
  409. Plots are squashed vertically.
  410. .PP
  411. .I Quickplot
  412. attempts to identify dotted, dashed, etc. lines by plotting alternate
  413. characters in a line as a small integer digit representing the line
  414. type.  For short line segments, this doesn't work very well, since there
  415. is no memory of the previous line segment.
  416. SHAR_EOF
  417. if test 3842 -ne "`wc -c < 'quickplot.p'`"
  418. then
  419.     echo shar: error transmitting "'quickplot.p'" '(should have been 3842 characters)'
  420. fi
  421. fi
  422. exit 0
  423. #    End of shell archive
  424.